<?php

class CompanyModel extends AbstractModel
{

    protected $_opinions;
    protected $_comments;
    protected $_user;
    protected $_activity;
    protected $_similarCompanies;

    protected function _init()
    {
	
    }

    public function setSimilarCompanies($similarCompanies)
    {
	$this->_similarCompanies = $similarCompanies;
    }

    public function getSimilarCompanies()
    {
	return $this->_similarCompanies;
    }

    public function setActivity(ActivityModel $model)
    {
	$this->_activity = $model;
    }

    public function getActivity()
    {
	return $this->_activity;
    }

    public function setUser(UserModel $model)
    {
	$this->_user = $model;
    }

    public function getUser()
    {
	return $this->_user;
    }

    public function getOpinions()
    {
	return $this->_opinions;
    }

    public function setOpinions($opinions)
    {
	$this->_opinions = $opinions;
    }

    public function getComments()
    {
	return $this->_comments;
    }

    public function setComments($comments)
    {
	$this->_comments = $comments;
    }

    public function getLogo()
    {
	if ($this->getDbData('logo')) {
	    return $this->getDbData('logo');
	}
	return Yii::app()->params['defaultLogo'];
    }

    public function getViewLink($hash = null)
    {
	if ($this->getId() && $this->getDbData('url')) {
	    $params = array('id' => $this->getId(), 'url' => $this->getDbData('url'));
	    if ($hash) {
		$params['#'] = $hash;
	    }
	    return Yii::app()->createUrl('company/view', $params);
	}
	return false;	
    }

}

?>
